<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户权限管理</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/static/bootstrap/css/bootstrap.css">
<style type="text/css">
	.msg{
		color:red;
		font-size:12px;
	}
</style>
</head>
<body>
	<h1>用户管理</h1>
	<form action="${pageContext.request.contextPath }/admin/updateAll" method="post">
		<table class="table table-bordered table-striped table-hover">
			<tr>
				<td></td>
				<td>编号</td>
				<td>卡号</td>
				<td>用户名</td>
				<td>密码</td>
				<td>套餐</td>
				<td>预存金额</td>
				<td>剩余金额</td>
				<td>注册时间</td>
				<td>状态</td>
				<td>用户权限</td>
			</tr>
			<c:forEach var="user" items="${pagehelper.list }" varStatus="vs">
				<tr>
					<td><input type="hidden" name="uList[${vs.index }].id" value="${user.id }"></td>
					<td>${vs.count }</td>
					<td><input name="uList[${vs.index }].card_number" value="${user.card_number }" readonly="readonly"></td>
					<td><input name="uList[${vs.index }].username" value="${user.username }"></td>
					<td><input name="uList[${vs.index }].password" value="${user.password }"></td>
					<td><select name="uList[${vs.index }].plan_id" >
						<c:forEach var="plan" items="${planList }" varStatus="st">
							<option value="${plan.id}" <c:if test="${user.plan_id==plan.id }">selected</c:if> >id:${plan.id } 套餐:${plan.plan_name } 通话时长:${plan.call_time} 上网流量:${plan.data_usage } 短信条数:${plan.sms_count } 资费:${plan.monthly_fee }</option>
						</c:forEach>
						</select><br> 
					</td>
					<td><input name="uList[${vs.index }].prepaid_amount" value="${user.prepaid_amount }"></td>
					<td><input name="uList[${vs.index }].balance" value="${user.balance }"></td>
					<td><input name="uList[${vs.index }].register_time" value="${user.register_time }" readonly="readonly"></td>
					<td><select name="uList[${vs.index }].status">
						<option value="1" <c:if test="${user.status=='1' }">selected</c:if>>正常</option>
						<option value="0" <c:if test="${user.status=='0' }">selected</c:if>>异常</option>
					</select>
					</td>
					<td><select name="uList[${vs.index }].role">
							<option value="user" <c:if test="${user.role=='user' }">selected</c:if> >普通用户</option>
							<option value="admin" <c:if test="${user.role=='admin' }">selected</c:if> >管理员</option>
						</select>
					</td>
				</tr>
			</c:forEach>	
		</table>
		<input type="submit" value="保存修改">
		<input type="button" value="返回" onclick="history.go(-1)">
		<%@include file="pagehelper_plxg.jsp" %>
		${msg }
		</form>
</body>
</html>